<%--
  Created by IntelliJ IDEA.
  User: HP
  Date: 2021/9/24
  Time: 9:51
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<% String path=request.getContextPath()+"/";%>
<html>
<head>
    <base href="<%=path%>">
    <title>权限管理登录</title>

    <link href="hplus-master/css/bootstrap.min.css" rel="stylesheet">
    <link href="hplus-master/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="hplus-master/css/animate.css" rel="stylesheet">
    <link href="hplus-master/css/style.css" rel="stylesheet">
    <link href="hplus-master/css/login.css" rel="stylesheet">
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <script>
        if (window.top !== window.self) {
            window.top.location = window.location;
        }
    </script>

</head>

<body class="signin">
<div class="signinpanel">
    <div class="row">
        <div class="col-sm-7">
            <div class="signin-info">
                <div class="logopanel m-b">
                    <h1>[ 青笙 ]</h1>
                </div>
                <div class="m-b"></div>
                <h4>欢迎使用 <strong> 权限管理系统</strong></h4>
                <ul class="m-b">
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> SpringMvc</li>
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> Mybatis</li>
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> bootStrap</li>
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> shiro</li>
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> Rbac</li>
                </ul>
                <strong>还没有账号？ <a href="#">立即注册&raquo;</a></strong>
            </div>
        </div>
        <div class="col-sm-5">
            <form method="post" id="logins" >
                <h4 class="no-margins">登录：</h4>
                <p class="m-t-md">登录到权限管理系统</p>
                <input type="text" class="form-control uname" placeholder="用户名"  name="loginName"/>
                <input type="password" class="form-control pword m-b" placeholder="密码" name="loginPwd" />
                <div class="input-group m-t m-b">
                    <input type="text" style="color: black" name="code" class="form-control no-margins" placeholder="验证码">
                    <span class="input-group-addon no-padding"><img id="verification" src="/verification" height="30px" style="cursor: pointer;" title="看不清？换一张" /></span>
                </div>
                <a href="">忘记密码了？</a>
                <button class="btn btn-success btn-block" type="button" id="login">登录</button>
            </form>
        </div>
    </div>
    <div class="signup-footer">
        <div class="pull-left">
            &copy; 2015 All Rights Reserved. H++
        </div>
    </div>
</div>
</body>
<script src="hplus-master/js/jquery.min.js?v=2.1.4" ></script>
<script src="hplus-master/js/plugins/layer/layer.min.js"></script>
<script type="text/javascript">
    $(function () {
        // 刷新验证码
        $("#verification").bind("click", function () {
            $(this).hide().attr('src', '/verification?random=' + Math.random()).fadeIn();
        });
    });
    $(function (){
        //登录验证
        $("#login").click(function (){
                document.location.href='index'
          var param =  $("#logins").serialize();

           $.ajax(
                {
                    url:'login',
                    type:'post',
                    dataType:'json',
                    data:param,
                    success:function(ret){

                        if (ret.code==200){
                            layer.msg('登陆成功', {
                                offset: 't',
                                anim: 6
                            });
                            document.location.href='index'
                        }
                        if (ret.code==600){
                            layer.msg("用户名不存在",{
                                offset:'t',
                                anim:6
                            })
                            $(".uname").val(' ')
                            $('.uname').focus();
                            return
                        }
                        if (ret.code==601){
                            layer.msg("用户名或者密码错误",{
                                offset:'t',
                                anim:6
                            })
                            $(".uname").val(' ')
                            $(".pword").val(' ')
                            return
                        }
                        if (ret.code==602){
                            layer.msg(ret.msg,{
                                offset:'t',
                                anim:6
                            })

                            return
                        }
                    }
                }
            )
        }
        )

    })

</script>
</html>
